window.onProgress = null;
window.onGameStarted = function(cc) {
  window._CCSettings = undefined;
  cc.view.resizeWithBrowserSize(true);
  var launchScene = "db://assets/scenes/login.scene"; 
  // load scene
  cc.director.preloadScene(launchScene,onProgress,function(){
    cc.game.run()
    // cc.director.loadScene(launchScene,null,  function () {
    //   // cc.view.setDesignResolutionSize(960, 640, 4);
    //   // console.log("Success to load scene: ".concat(launchScene));
    //   cc.game.run()
    // });
  })
}
window.setLoadingDisplay = function  () {
  // Loading splash scene
  var splash = document.getElementById('splash');
  var progressBar = splash.querySelector('.progress-bar  .progress-bar-2');
  onProgress = function (finish, total) {
      var percent = 100 * finish / total;
      console.log(percent,'调用');
      /* if (percent < 44) {
        percent = 44;
      } */
      if (progressBar) {
        console.log((-100 + Number(percent.toFixed(2)) ) + '%','-100 +  percent.toFixed(2) + '%'');
        progressBar.style.left = (-100 + Number(percent.toFixed(2)) ) + '%';
      }
  };
  splash.style.display = 'block';
  // progressBar.style.width = '0%';
  cc.director.once(cc.Director.EVENT_AFTER_SCENE_LAUNCH, function () {
      splash.style.display = 'none';
  });
}

// 设置logo
// let tag = localStorage.getItem('ChangeLanguage');
// let logo = document.querySelector('.logo');
// if (tag && tag == 1) {
//   logo.src = "./images/hall_sign.png"
// }
// else {
//   logo.src = "./images/hall_sign2.png"
// }

// System.register([], function (_export, _context) {
//     "use strict";
  
//     var cc, Application;
  
//     function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  
//     function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  
//     function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
    
//     return {
//       setters: [],
//       execute: function () {
//         _export("Application", Application = /*#__PURE__*/function () {
//           function Application() {
//             _classCallCheck(this, Application);
  
//             this.settingsPath = 'src/settings.ce18d.json';
//             this.showFPS = false;
//           }
  
//           _createClass(Application, [{
//             key: "init",
//             value: function init(engine) {
//               cc = engine;
//               setLoadingDisplay()
//               cc.game.onPostBaseInitDelegate.add(this.onPostInitBase.bind(this));
//               cc.game.onPostSubsystemInitDelegate.add(this.onPostSystemInit.bind(this));
//             }
//           }, {
//             key: "onPostInitBase",
//             value: function onPostInitBase() {// cc.settings.overrideSettings('assets', 'server', '');
//               // do custom logic
//             }
//           }, {
//             key: "onPostSystemInit",
//             value: function onPostSystemInit() {// do custom logic
//             }
//           }, {
//             key: "start",
//             value: function start(a,b) {
//               // console.log(a,b,'xxxx');
//               return cc.game.init({
//                 debugMode: false ? cc.DebugMode.INFO : cc.DebugMode.ERROR,
//                 settingsPath: this.settingsPath,
//                 overrideSettings: {
//                   // assets: {
//                   //      preloadBundles: [{ bundle: 'main', version: 'xxx' }],
//                   // }
//                   profiling: {
//                     showFPS: this.showFPS
//                   }
//                 }
//               }).then(function (res) {
//                 console.log(this,'');
//                 // return cc.game.run()
//                 cc.game.onStart = onGameStarted.bind(null, cc);
//                 onGameStarted(cc, settingsPath)
//               });
//             }
//           }]);
  
//           return Application;
//         }());
//       }
//     };
//   });